package com.dongchedi.utils;

/**
 * @author leibidong
 * @description 账号，密码格式验证
 * @date 2021/6/26
 */
public class CheckUtil {
    /*
     * @Author: leibidong
     * @Description:账号必须是5到14位数字，并且不能以0开头
     * @Date: 2021/6/26 18:58
     * @Param: [loginName]
     * @Return: boolean
     **/
    public  static  boolean checkLoginName(String loginName){
   return loginName.matches("[1-9][0-9]{5,14}");
    }
    /*
     * @Author: leibidong
     * @Description:密码只能是字母和数字，范围是5-16位
     * @Date: 2021/6/26 19:20
     * @Param: [password]
     * @Return: boolean
     **/
    public static boolean checkPassword(String password){

        return password.matches("[a-zA-Z0-9_]{5,16}$");
    }
    /*
     * @Author: leibidong
     * @Description: 检查手机号是否合法
     * @Date: 2021/7/1 20:06
     * @Param: [phone]
     * @Return: boolean
     **/
    public static boolean checkPhone(String phone){

        return phone.matches("[1][3-9]([0-9]{9})");
    }
}
